" 参考 https://www.cnblogs.com/jiqingwu/archive/2012/06/14/vim_notes.html
" 引号为注释  
" 显示行号
set number

" 设置tab宽为4字符长度
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab

" 高亮显示关键字
syntax on
syntax enable

" 高亮显示搜索
set hlsearch
set incsearch

" 显示光标位置
set ruler

" 状态栏行数，2表示显示文件名
set laststatus=2

" 编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

" 语言设置
set helplang=en

" 命令行（在状态行下）的高度
set cmdheight=1

set paste

" 自动缩进
set autoindent
set cindent
set smartindent

" 历史记录数
set history=1000

" 输入的命令显示出来，看的清楚些
set showcmd

" 在处理未保存或只读文件的时候，弹出确认
set confirm

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"打开文件时自动添加标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufNewFile *.h,*.hpp,*.c,*.cc,*.cpp exec ":call AddCTitle()"
function AddCTitle()
	call append(0,"/********************************************************************************")
   	call append(1,"** ")
	call append(2,"** Filename: \t  ".expand("%:t"))
	call append(3,"** Author: \t\t  xxxx")
	call append(4,"** Email: \t\t  xxxx@gmail.com")
	call append(5,"** Date: \t\t  ".strftime("%Y-%m-%d %H:%M:%S"))
	call append(6,"** ")
	call append(7,"********************************************************************************/")
endfunction

autocmd BufNewFile *.py exec ":call AddPyTitle()"
function AddPyTitle()
	call append(0,"#!/usr/bin/env python")
	call append(1,"#coding:utf-8")
	call append(2,"")
	call append(3,"'''********************************************************************************")
   	call append(4,"** ")
	call append(5,"** Filename: \t  ".expand("%:t"))
	call append(6,"** Author: \t\t  xxxx")
	call append(7,"** Email: \t\t  xxxx@gmail.com")
	call append(8,"** Date: \t\t  ".strftime("%Y-%m-%d %H:%M:%S"))
	call append(9,"** ")
	call append(10,"********************************************************************************'''")
endfunction

